#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>

int main()
{
    printf("env不同语言的影响");

    char *args[] = {"date", NULL};

    // 英语环境
    printf("1.英语环境\n");
    char *english_env[] = {
        "LANG=en_US.UTF-8",
        "PATH=/bin:/user/bin",
        NULL
    };

    if(fork() == 0){
        execvpe("date", args, english_env);
        perror("exec failed");
    }
    wait(NULL);

    // 中文环境
    printf("2.中文环境\n");
    char *chinese_env[] = {
        "LANG=zh_CN.UTF-8",
        "PATH=/bin:/user/bin",
        NULL
    };

    if(fork() == 0)
    {
        execvpe("date", args, chinese_env);
        perror("exec failed");
    }
    wait(NULL);

    return 0;
}
